﻿using System.Collections.Generic;
using System.Linq;
using Crawler.Domain;

namespace Crawler.DomainServices.Processors
{
	internal class PageContentProcessorProvider : IPageContentProcessorProvider
	{
		private readonly IEnumerable<IPageContentProcessor> _processors;

		public PageContentProcessorProvider(IEnumerable<IPageContentProcessor> processors)
		{
			_processors = processors;
		}

		public IPageContentProcessor Get(PageSource source)
		{
			return _processors.Single(x => x.ForSource == source);
		}
	}
}